/*
 * @Author: early-autumn
 * @Date: 2020-05-06 09:53:16
 * @LastEditors: early-autumn
 * @LastEditTime: 2020-05-11 23:32:43
 */
export default {
  events: {},
  on(key, func) {
    this.events[key] = this.events[key] || []
    this.events[key].push(func)
  },
  emit(key, arg) {
    this.events[key].forEach((func) => func(arg))
  },
  off(key) {
    delete this.events[key]
  },
}
